﻿<UserControl x:Class="StockholmsStad.Windows.UI.Modules.Ceremony.Controls.CeremonyNextDetailsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:StockholmsStad.Windows.UI.Infrastructure.Converters;assembly=StockholmsStad.Windows.UI.Infrastructure"
    >
    <UserControl.Resources>
        <converters:CeremonyTypeToBoolConverter x:Key="ceremonyTypeConverter" />
        <converters:MarriageCertificateTypeToStringConverter x:Key="enumConverter" />
        <converters:BoolToStringConverter x:Key="boolConverter" />
        <converters:StringToShortStringConverter x:Key="stringConverter" />
    </UserControl.Resources>

    <GroupBox Header="Kommande" Margin="5,5,5,5" Padding="5,10,5,5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ListView x:Name="listViewCeremonies" ItemsSource="{Binding}" Grid.Row="0" MaxHeight="300" ItemContainerStyle="{DynamicResource ListViewItemStyleNoInteraction}"> <!---->
                <ListView.View>
                    <GridView ColumnHeaderContainerStyle="{DynamicResource GridViewColumnHeaderStyle1}" AllowsColumnReorder="False">
                        <GridView.Columns>
                            <GridViewColumn Header="Tid">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding StartEndTime}" VerticalAlignment="Center">
                                            <TextBlock.Style>
                                                <Style>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding CeremonyType, Converter={StaticResource ceremonyTypeConverter}}" Value="False">
                                                            <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBlock.Style>
                                        </TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>                                
                            </GridViewColumn>
                            <GridViewColumn Header="Par">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Path=Person1.FullName}" />
                                            <TextBlock Text=" / " />
                                            <TextBlock Text="{Binding Path=Person2.FullName}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Förrättare">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Minister.FullName}" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="HP" DisplayMemberBinding="{Binding ImpedimentDoc, Converter={StaticResource boolConverter}}" />
                            <GridViewColumn Header="SB">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding SpecialNeeds[0].Name}" VerticalAlignment="Center" />
                                            <Button DataContext="{Binding}" Click="btnSpecialNeeds_Click" VerticalAlignment="Center"
                                                    VerticalContentAlignment="Center" Width="25" Height="20" Margin="5,0,0,0">
                                                <Image Source="/StockholmsStad.Windows.UI.Infrastructure;component/Images/magnifier.png" />
                                                <Button.Style>
                                                    <Style>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding SpecialNeeds}" Value="{x:Null}">
                                                                <Setter Property="Button.Visibility" Value="Hidden" />
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>                                                    
                                                </Button.Style>
                                            </Button>
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Ceremonispråk" DisplayMemberBinding="{Binding Path=CeremonyLanguage.Name}" />
                            <GridViewColumn Header="Tolk" DisplayMemberBinding="{Binding Path=Interpreter, Converter={StaticResource boolConverter}}" />
                            <GridViewColumn Header="Notering">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Note, Converter={StaticResource stringConverter}}" VerticalAlignment="Center" />
                                                <Button Name="Par" Width="24" Height="24" Margin="5,0,0,0" DataContext="{Binding}" Click="btnNotes_Click"
                                                        VerticalContentAlignment="Center" VerticalAlignment="Center" >
                                                    <Image Source="/StockholmsStad.Windows.UI.Infrastructure;component/Images/magnifier.png" />
                                                    <Button.Style>
                                                        <Style>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding ShowNotes}" Value="False">
                                                                    <Setter Property="Button.Visibility" Value="Hidden" />
                                                                </DataTrigger>                                                                
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Button.Style>
                                                    <Button.Triggers>
                                                        <!-- Synlig/inte synlig -->
                                                    </Button.Triggers>
                                                </Button>
                                            </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Avboka">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="Avboka" DataContext="{Binding}" Click="btnCancelBooking_Click" 
                                                Command="{Binding CancelCommand}" 
                                                Height="20" VerticalContentAlignment="Center" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Skriv ut">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="Skriv ut" DataContext="{Binding}" Click="btnPrint_Click" Height="20" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
            </Grid>
    </GroupBox>
</UserControl>
